<template>
	<view class="content" style="margin-top: -10px;padding: 20px;">
		<u-row customStyle="margin: 10px 10px 10px 10px">
			<u-col span="12">
				<view class="demo-layout bg-purple">
					学员号：{{personInfo.studentID}}
				</view>
			</u-col>
			<!-- <u-col span="6">
				<view class="demo-layout bg-purple">
					姓名：{{personInfo.studentName}}
				</view>
			</u-col> -->
		</u-row>
		<u-row customStyle="margin: 10px">
			<u-col span="12">
				<view class="demo-layout bg-purple">
					姓名：{{personInfo.studentName}}
				</view>
			</u-col>
		</u-row>
		<u-row customStyle="margin: 10px">
			<u-col span="12">
				<view class="demo-layout bg-purple">
					性别：{{personInfo.studentGender}}
				</view>
			</u-col>
		</u-row>
		<u-row customStyle="margin: 10px">
			<u-col span="12">
				<view class="demo-layout bg-purple">
					出生日期：{{personInfo.birthDate}}
				</view>
			</u-col>
		</u-row>
		<u-row customStyle="margin: 10px">
			<u-col span="12">
				<view class="demo-layout bg-purple">
					首报日期：{{personInfo.firstSignupDate}}
				</view>
			</u-col>
		</u-row>
		<u-row customStyle="margin: 10px">
			<u-col span="12">
				<view class="demo-layout bg-purple">
					报名课程：{{personInfo.firstSignCourse}}
				</view>
			</u-col>
		</u-row>
		<u-row customStyle="margin: 10px">
			<u-col span="12">
				<view class="demo-layout bg-purple">
					首报金额：{{personInfo.firstMoney}}
				</view>
			</u-col>
		</u-row>
		<u-row customStyle="margin: 10px">
			<u-col span="12">
				<view class="demo-layout bg-purple">
					联系电话：{{personInfo.studentPhone}}
				</view>
			</u-col>
		</u-row>
	</view>
</template>

<script>
	import {ip,port} from '@/ipconfig.js'
	export default {
		data() {
			return {
				personInfo:{
					// studentID: '1008611',
					// studentName: '张三',
					// studentGender: '男',
					// birthDate: '2023-03-03',
					// firstSignupDate: '2023-03-15',
					// firstSignCourse: '编程',
					// firstMoney: '7000',
					// studentPhone: '13827892389'
				}
			}
		},
		onLoad(id) {
			let that = this;
			let stuId;
			if(id == null || id.id == null){
				uni.getStorage({
					key:'id-key',
					success: (res) => {
						stuId = res.data;
					}
				})
			}else{
				uni.setStorage({
					key: "id-key",
					data: id.id,
					success: () => {
						console.log("id已缓存");
					}
				});
				stuId = id.id;
			}
			uni.request({
				// url:`/api/student/student/person/${stuId}`,
				url:`${ip}:${port}/student/student/person/${stuId}`,
				method: "GET",
				sslVerify:false,
				success: (res) => {
					if(res.statusCode && res.statusCode != 200){
						uni.showToast({
							icon:'none',
							title:res.errMsg
						})
						return;
					}
					console.log(res.data.data);
					that.personInfo = res.data.data.personInfo;
				},
				fail: (err) => {
					uni.showToast({
						icon:'none',
						title:err
					})
					return;
				}
			});
		},
		methods: {

		}
	}
</script>

<style>
	.content {
		text-align: center;
		height: 100%; 
		/* background-image: url('/static/main-bg.jpg'); */ 
		background-image: url("");
	}
</style>
